<template>
  <div class="m-crumbs">
    <el-breadcrumb separator=">">
      <el-breadcrumb-item
        :to="{ path: '/' }"
      >
        {{
          city.replace('市', '')
        }}美团
      </el-breadcrumb-item>
      <el-breadcrumb-item>
        <span @click="goback">{{ city.replace('市', '')
        }}{{ type }}</span>
      </el-breadcrumb-item>
      <el-breadcrumb-item @click="reload">
        {{ city.replace('市', '')
        }}{{ decodeURIComponent(keyword) }}
      </el-breadcrumb-item>
    </el-breadcrumb>
  </div>
</template>

<script>
import cookies from 'vue-cookies'
export default {
  props: {
    keyword: {
      type: String,
      default: ''
    },
    type: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      city: ''
    }
  },
  mounted () {
    this.city = cookies.get('city') ? cookies.get('city') : this.$store.state.geo.position.city
  },
  methods: {
    goback () {
      history.go(-1)
    },
    reload () {
      location.reload()
    }

  }
}
</script>
